// Author: Domien Nowicki

#ifndef CAMERAWIDGET_H
#define CAMERAWIDGET_H

#include <QGraphicsItem>
#include "Scalar.h"

class CameraWidget: public QObject, public QGraphicsItem
{
	Q_OBJECT 
public:
	CameraWidget(QObject *parent=0);
	virtual ~CameraWidget();

	unsigned int GetWidth() const;
	unsigned int GetHeight() const;

	const Scalar& GetAngle() const;
	void SetAngle(const Scalar& angle);
	void EnableRotation();
	void DisableRotation();

protected:
	QRectF boundingRect() const;
	QPainterPath shape() const;
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
	void hoverEnterEvent(QGraphicsSceneHoverEvent *e);
	void hoverLeaveEvent(QGraphicsSceneHoverEvent *e);
	void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
	void mousePressEvent(QGraphicsSceneMouseEvent *e);
signals:
	void clicked();
	void rotated(const Scalar& angle);
private:

	bool highlight;
	Scalar angle;
	bool canRotate;



	static const unsigned int BOXSIZE = 64, ANGLESIZE = 30;
};

#endif // CAMERAWIDGET_H
